<template>

  <el-menu :default-active="activeIndex" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
      <el-menu-item index="1" @click="toMain">
      <i class="el-icon-s-help"></i>
      <span slot="title">仪盘表</span>
    </el-menu-item>
    <el-menu-item index="2" @click="toImg">
      <i class="el-icon-menu"></i>
      <span slot="title">图片库</span>
    </el-menu-item>
    <el-menu-item index="3" @click="toWeather">
      <i class="el-icon-document"></i>
      <span slot="title">气象数据</span>
    </el-menu-item>
    <el-menu-item index="4" @click="toPower">
      <i class="el-icon-setting" ></i>
      <span slot="title">电源数据</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
  import Cookies from 'js-cookie'
  import Pro from '../../api/API_PRO'
    export default {
      name: "cliMenu",
      props: {
        acIndex: {
          type: String
        },
        cameraId:{
          type: String
        }
      },
      data() {
        return {
          activeIndex: "2",
          name: '',
          isadmin: false,
          centerDialogVisible: false,
          isShowdefMan: false,
          isShowJudge: false,
          id: '',
          isCollapse: true,
          tabPosition: 'left',


          /**
           *  '0': 管理员
           *  '1'：普通用户
           * */
          type: Cookies.get('type'),
        }
      },
      mounted: function () {
        this.activeIndex = this.pageIndex
        /*        this.name=JSON.parse(Cookies.get("info")).name
        if (Cookies.get('type') === '0') {
          //普通用户
          this.isadmin = false
          this.id=0;
        }else if (Cookies.get('type') === '1') {
          //管理员
          this.isadmin = true
          this.id=1;
        }
        else if (Cookies.get('type') === '2') {
          //评委

          this.id=2;
        }*/
      },
      methods: {
        handleOpen(key, keyPath) {
          console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
          console.log(key, keyPath);
        },
        handleClick(tab, event) {
          console.log(tab, event);
        },
        toMain(){
          this.$router.push({path: `/camera/`+this.cameraId+`/main`})
        },
        toImg(){
          this.$router.push({path: `/camera/`+this.cameraId+`/img`})
        },
        toWeather(){
          this.$router.push({path: `/camera/`+this.cameraId+`/weather`})
        },
        toPower(){
          this.$router.push({path: `/camera/`+this.cameraId+`/powerlog`})
        },
      }
    }

</script>

<style scoped>



</style>

